import { useTaskListStore } from "@/stores/tasklist"
export default {
    data() {
        return {
            shareUrl: '',
        }
    },
    onLoad: function () {},
    // @ts-ignore
    onShareAppMessage(res) {
        
        const that = this
        const imageUrl: String = that.shareUrl || ''
        if (res.from === 'button') {
            //这块需要传参，不然链接地址进去获取不到数据
            const result = {
                title: '你有一个任务需要处理~',
                path:`/` + that.$scope.route,
                imageUrl
            }
             
            const taskStore = useTaskListStore()
           // path += `?sharecode=` + that.$scope.options.share_code
            const tasklist = taskStore.taskList
            console.log("task list")
           console.log(tasklist.title)
           console.log(taskStore.title)
            if(tasklist){
                result.path += `?sharecode=` + tasklist.share_code
                if(tasklist.title){
                    result.title = tasklist.title
                }
            }
            return result
        }
        if (res.from === 'menu') {
            return {
                title: '我的小任务',
                imageUrl
            }
        }
    },
    // 分享到朋友圈
    onShareTimeline() {
        return {
            title: '我的小任务',
            path: '/pages/index/index',
            imageUrl: ''
        }
    },
    methods: {}
}
